﻿using System.ComponentModel.Composition;
using System.Windows.Input;
using Monti.MVVM;
using Monti.MVVM.Services;
using Peter.Common;

namespace Peter.TFS
{
   /// <summary>
   /// A media wiki editor plugin for peter.
   /// </summary>
   [Export (typeof (PeterPluginBase))]
   [PeterMetadata ("TFS Utilities", "Jonathan Montiverdi", "TFS integration for Peter.", "0.1")]
   public class TfsUtilities : PeterPluginBase
   {
      private RelayCommand m_CmdShowServer;

      #region Commands

      /// <summary>
      /// Gets the command to show the TFS server view.
      /// </summary>
      public ICommand ShowTfsServer
      {
         get
         {
            return this.m_CmdShowServer ?? (m_CmdShowServer = new RelayCommand (this.OnShowTfsServer));
         }
      }

      /// <summary>
      /// Shows the tfs server view.
      /// </summary>
      /// <param name="obj"></param>
      private void OnShowTfsServer (object obj)
      {
      }

      #endregion

      /// <summary>
      /// Installs the plugin.
      /// </summary>
      public override void Install ()
      {
         var host = ServiceManager.Resolve<IPeterHost> ();
         host.AddMainMenu (this.CreateMenu (), "TFS Utilities");
      }

      /// <summary>
      /// Creates the menu structure for TFS utilities.
      /// </summary>
      /// <returns></returns>
      private PeterMenuItem CreateMenu ()
      {
         var mainMenu = new PeterMenuItem ("TFS");
         var menuItem = new PeterMenuItem ("TFS Server View") { Command = this.ShowTfsServer };
         mainMenu.Children.Add (menuItem);
         return mainMenu;
      }
   }
}
